package com.meicet.adapter

import android.content.Context
import android.graphics.Color
import android.os.Build
import com.blankj.utilcode.util.SnackbarUtils
import com.blankj.utilcode.util.TimeUtils
import com.blankj.utilcode.util.ToastUtils
import com.meicet.adapter.utils._i
import com.meicet.adapter.utils.buildVersionP
import com.tencent.mmkv.MMKV

object BaseAdapterConfig {
    var debug = false

    fun initConfig(app: Context,debug: Boolean) {
        this.debug=debug
        val rootDir = MMKV.initialize(app)
        _i("BaseAppConfig", "MMKV  rootDir=$rootDir")
    }

    @JvmStatic
    var onClickTimeDebouncing = 200L

    fun openDebug(debug: Boolean) {
        this.debug = debug
        if (debug) {
            printInfo()
        }
        initToast()
    }

    private fun initToast() {
        ToastUtils.getDefaultMaker().setMode(ToastUtils.MODE.LIGHT)
    }

    fun printInfo() {
        val sb = StringBuilder()
        val head = "************* Log Head ****************" +
                "[---------启动APP-----]:${TimeUtils.getNowString()} " +
                "\nVERSION.RELEASE    : " + Build.VERSION.RELEASE +
                "\nVERSION.SDK_INT版本  : " + Build.VERSION.SDK_INT +
                "\nVERSION.USER      : " + Build.VERSION.CODENAME +
                "\nBuild.Manufacturer: " + Build.MANUFACTURER +
                "\nBuild.MODEL        : " + Build.MODEL +
                "\nBuild.PRODUCT      : " + Build.PRODUCT +
                "\nBuild.BOARD      : " + Build.BOARD +
                "\nBuild.DEVICE      : " + Build.DEVICE +
                "\nBuild.DISPLAY      : " + Build.DISPLAY +
                "\nBuild.HARDWARE      : " + Build.HARDWARE +
                "\nBuild.SUPPORTED_ABIS      : " + Build.SUPPORTED_ABIS.toList() +
                "\nBuild.USER      : " + Build.USER +
                "\n************* Log end ****************\n\n"
        sb.append(head)
        buildVersionP()
        _i("BaseAdapterConfig", sb.toString())
    }

    // 一页多少条数据
    var PageSize = 15

    // 第一页从1开始
    var PageFirst = 1
}
